#include <stdio.h>

#include <algorithm>
#include <functional>
#include <vector>

using namespace std;

int n, m;
vector<int> A;

int main() {
  freopen("in.txt", "r", stdin);
  scanf("%d%d", &n, &m);
  A.resize(n + 5);
  for (int i = 1; i <= n; ++i) {
    A[i] = i;
  }
  while (m--) {
    int p, q;
    scanf("%d%d", &p, &q);
    if (p) {
      sort(A.begin() + q, A.begin() + n + 1);  // 升序。
    } else {
      sort(A.begin() + 1, A.begin() + q + 1, greater<int>());
    }
  }

  for (int i = 1; i <= n; ++i) {
    printf("%d%s", A[i], i == n ? "\n" : " ");
  }
  
  return 0;
}